﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.Servico.Bovespa.Ordens.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{
    public static class Motivo
    {
        public static DataContract.Response.MotivoResponse ToMotivoResponse(BusinessEntity.Motivo from)
        {
            DataContract.Response.MotivoResponse to = null;

            if (from != null)
            {
                to = new Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Response.MotivoResponse();

                to.Codigo = from.Codigo;
                to.Descricao = from.Descricao;
            }

            return to;
        }

        public static List<DataContract.Response.MotivoResponse> ToMotivoResponse(List<BusinessEntity.Motivo> from)
        {
            List<DataContract.Response.MotivoResponse> to = null;
            if (from != null)
            {
                to = new List<Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Response.MotivoResponse>();

                foreach (BusinessEntity.Motivo item in from)
                    to.Add(ToMotivoResponse(item));
            }

            return to;
 
        }

    }
}
